import {defineStore} from 'pinia';
import $router from '@/sheep/router';
import user from './user';
import sys from './sys';

function isRealEmpty(val) {
  return val === null || val === undefined || val === 'null' || val === 'undefined' || val === '';
}

const app = defineStore({
  id: 'app',
  state: () => ({
    info: {
      // 应用信息
      name: '', // 商城名称
      logo: '', // logo
      version: '', // 版本号
      cdnurl: '', // 云存储域名
      filesystem: '', // 云存储平台
      user_protocol: {}, // 用户协议
      privacy_protocol: {}, // 隐私协议
      about_us: {}, // 关于我们
      copyright: '', // 版权信息 I
      copytime: '', // 版权信息 II
    },
    platform: {
      payment: [], // 支持的支付方式
      recharge_payment: [], // 支持的充值支付方式
      share: {
        methods: [], // 支持的分享方式
        forwardInfo: {}, // 默认转发信息
        posterInfo: {}, // 海报信息
        linkAddress: '', // 复制链接地址
      },
      auto_login: 0, // 自动登陆
      bind_mobile: 0, // 登陆后绑定手机号提醒 (弱提醒，可手动关闭)
    },
    chat: {},
    template: {
      // 店铺装修模板
      basic: {}, // 基本信息
      home: {
        // 首页模板
        style: {},
        data: [],
      },
      user: {
        // 个人中心模板
        style: {},
        data: [],
      },
    },
    shareInfo: {}, // 全局分享信息
    authInfo: null
  }),
  actions: {
    // 获取Shopro应用配置和模板
    async init(templateId = null) {
      //检查网络
      // const networkStatus = await $platform.checkNetwork();
      // if (!networkStatus) {
      //   $router.error('NetworkError');
      // }
      const res = {
        "error": 0,
        "msg": "初始化",
        "data": {
          "app": {
            "name": "IM",
            "logo": "\/static\/logo.png",
            "cdnurl": "https:\/\/file.sheepjs.com",
            "filesystem": "qcloud",
            "version": "1.0.0",
            "user_protocol": {
              "title": "用户协议",
              "id": "1"
            },
            "privacy_protocol": {
              "title": "隐私协议",
              "id": "2"
            },
            "about_us": {
              "title": "关于我们",
              "id": "3"
            },
            "copyright": "",
            "copytime": ""
          },
          "platform": {
            "auto_login": 0,
            "bind_mobile": 0,
            "payment": [
              "money",
              "alipay",
              "wechat",
              "offline"
            ],
            "recharge_payment": [
              "wechat",
              "alipay"
            ],
            "share": {
              "methods": [
                "poster",
                "link"
              ],
              "linkAddress": "https:\/\/mall.ichengle.top\/uni\/#\/",
              "posterInfo": {
                "user_bg": "\/static\/img\/shop\/config\/user-poster-bg.png",
                "goods_bg": "\/static\/img\/shop\/config\/goods-poster-bg.png",
                "groupon_bg": "\/static\/img\/shop\/config\/groupon-poster-bg.png"
              }
            }
          },
          "template": {
            "basic": {
              "tabbar": {
                "mode": 1,
                "layout": 2,
                "inactiveColor": "#939598",
                "activeColor": "#000000",
                "list": [
                  {
                    "inactiveIcon": "https://ribotrade-oss.oss-cn-beijing.aliyuncs.com/2025/05/0480ebfd7bd627417996f2a4f84ea42f9b组合 55 (1).png",
                    "activeIcon": "https://ribotrade-oss.oss-cn-beijing.aliyuncs.com/2025/05/0480ebfd7bd627417996f2a4f84ea42f9b组合 55 (1).png",
                    "url": "\/pages\/index\/index",
                    "text": "化妆首页"
                  },
                  /*{
                    "inactiveIcon": "https://img.js.design/assets/img/65dac4f2d7645d3228e53ac0.png#84d2f2dba444ab9c3e1c447edd48f459",
                    "activeIcon": "https://img.js.design/assets/img/65dacc3da5ebb5733f780eb3.png#ab3d75f1f60eadbdb1b456f3b76a7220g",
                    "url": "\/pages\/index\/topic",
                    "text": "话题"
                  },*/
                  /*{
                    "inactiveIcon": "https://img.js.design/assets/img/65dac511d6cf52f9c69af0b9.png#357c791287e0505828010cc80a4e4718",
                    "activeIcon": "https://img.js.design/assets/img/65dacc4abc5f4c2017dcfa07.png#06f665b4ccf2d5ecd3d02db1d60f7a15",
                    "url": "\/pages\/index\/category",
                    "text": "分类"
                  },*/
                  {
                    "inactiveIcon": "https://ribotrade-oss.oss-cn-beijing.aliyuncs.com/2025/05/045f5032a1e3ab4010818083ba472489d5image.png",
                    "activeIcon": "https://ribotrade-oss.oss-cn-beijing.aliyuncs.com/2025/05/045f5032a1e3ab4010818083ba472489d5image.png",
                    "url": "\/pages\/index\/faceAnalysis",
                    "text": "化妆盒"
                  },
                  {
                    "inactiveIcon": "https://ribotrade-oss.oss-cn-beijing.aliyuncs.com/2025/05/0402cf0d4312484641bf45b3723cf91299image.png",
                    "activeIcon": "https://ribotrade-oss.oss-cn-beijing.aliyuncs.com/2025/05/0402cf0d4312484641bf45b3723cf91299image.png",
                    "url": "\/pages\/index\/faceAnalysis",
                    "text": "面容分析"
                  }
                ],
                "background": {
                  "type": "color",
                  "bgImage": "",
                  "bgColor": "#FED1D8"
                }
              },
              "floatMenu": {
                "show": 0,
                "mode": 1,
                "isText": 0,
                "list": [
                  {
                    "src": "",
                    "url": "",
                    "title": {
                      "text": "",
                      "color": ""
                    }
                  }
                ]
              },
              "popupImage": {
                "list": [
                  {
                    "src": "\/storage\/decorate\/20221115\/6bfd03d0ad7f3d7f6ba7494c903cdc0c.png",
                    "url": "\/pages\/index\/category?id=21",
                    "show": 2
                  }
                ]
              },
              "theme": "orange"
            },
            "home": {
              "data": [
                {
                  "type": "imageBanner",
                  "data": {
                    "mode": 1,
                    "indicator": 1,
                    "list": [
                      {
                        "title": "banner01",
                        "type": "image",
                        "src": "\/storage\/default\/20230110\/fb5f5d3ade8990c789217b35fba27ef8.png",
                        "poster": "",
                        "url": "\/pages\/index\/category?id=21"
                      }
                    ],
                    "space": 0
                  },
                  "style": {
                    "background": {
                      "type": "color",
                      "bgImage": "",
                      "bgColor": "#FFFFFF"
                    },
                    "marginLeft": 0,
                    "marginRight": 0,
                    "marginTop": 0,
                    "marginBottom": 10,
                    "borderRadiusTop": 0,
                    "borderRadiusBottom": 0,
                    "padding": 0
                  }
                },
                {
                  "type": "menuButton",
                  "data": {
                    "layout": 1,
                    "col": 5,
                    "row": 1,
                    "list": [
                      {
                        "src": "\/storage\/decorate\/20221115\/7e7da5a9fe78d731c217f14922b627bc.png",
                        "title": {
                          "text": "签到有礼",
                          "color": "#FFFFFF"
                        },
                        "url": "\/pages\/app\/sign",
                        "badge": {
                          "show": 0,
                          "text": "",
                          "color": "#FFFFFF",
                          "bgColor": "#F39800"
                        }
                      },
                      {
                        "src": "\/storage\/decorate\/20221115\/4a9bde33fd13459833431db72282e91c.png",
                        "title": {
                          "text": "居家生活",
                          "color": "#FFFFFF"
                        },
                        "url": "\/pages\/index\/category?id=21",
                        "badge": {
                          "show": 0,
                          "text": "",
                          "color": "#FFFFFF",
                          "bgColor": "#F39800"
                        }
                      },
                      {
                        "src": "\/storage\/decorate\/20221115\/e65f9b968d33f335cdff6b5e0befef8e.png",
                        "title": {
                          "text": "数码家电",
                          "color": "#FFFFFF"
                        },
                        "url": "\/pages\/index\/category?id=21",
                        "badge": {
                          "show": 0,
                          "text": "",
                          "color": "#FFFFFF",
                          "bgColor": "#F39800"
                        }
                      },
                      {
                        "src": "\/storage\/decorate\/20221115\/9918d064eefa8fb1fda5715db2c248ab.png",
                        "title": {
                          "text": "服饰鞋包",
                          "color": "#FFFFFF"
                        },
                        "url": "\/pages\/index\/category?id=21",
                        "badge": {
                          "show": 0,
                          "text": "",
                          "color": "#FFFFFF",
                          "bgColor": "#F39800"
                        }
                      },
                      {
                        "src": "\/storage\/decorate\/20221115\/f6c52397b662f42a29c4e0e6244b1b16.png",
                        "title": {
                          "text": "个护清洁",
                          "color": "#FFFFFF"
                        },
                        "url": "\/pages\/index\/category?id=21",
                        "badge": {
                          "show": 0,
                          "text": "",
                          "color": "#FFFFFF",
                          "bgColor": "#F39800"
                        }
                      }
                    ]
                  },
                  "style": {
                    "background": {
                      "type": "color",
                      "bgImage": "",
                      "bgColor": ""
                    },
                    "marginLeft": 0,
                    "marginRight": 0,
                    "marginTop": 0,
                    "marginBottom": 10,
                    "borderRadiusTop": 0,
                    "borderRadiusBottom": 0,
                    "padding": 0
                  }
                },
                {
                  "type": "imageCube",
                  "data": {
                    "borderRadiusTop": 8,
                    "borderRadiusBottom": 8,
                    "space": 7,
                    "list": [
                      {
                        "width": 2,
                        "height": 2,
                        "top": 0,
                        "left": 0,
                        "src": "\/storage\/decorate\/20221115\/63cbe4b8088a28a129923b65f412fcb2.png",
                        "url": "\/pages\/index\/category?id=21"
                      },
                      {
                        "width": 2,
                        "height": 1,
                        "top": 0,
                        "left": 2,
                        "src": "\/storage\/decorate\/20221115\/50e077b0a5df1c48dcd9be4e47b03324.png",
                        "url": "\/pages\/index\/category?id=21"
                      },
                      {
                        "width": 2,
                        "height": 1,
                        "top": 1,
                        "left": 2,
                        "src": "\/storage\/decorate\/20221115\/a44ee2a893e6b296efcd167fe0dc246d.png",
                        "url": "\/pages\/index\/category?id=21"
                      }
                    ]
                  },
                  "style": {
                    "background": {
                      "type": "color",
                      "bgImage": "",
                      "bgColor": ""
                    },
                    "marginLeft": 8,
                    "marginRight": 8,
                    "marginTop": 0,
                    "marginBottom": 10,
                    "borderRadiusTop": 0,
                    "borderRadiusBottom": 0,
                    "padding": 0
                  }
                },
                {
                  "type": "titleBlock",
                  "data": {
                    "src": "\/storage\/decorate\/20221115\/70845d2cb5fc68882b27ad3de9a100e0.png",
                    "location": "left",
                    "skew": 34,
                    "title": {
                      "text": "",
                      "color": "#262626",
                      "textFontSize": 16,
                      "other": []
                    },
                    "subtitle": {
                      "text": "",
                      "color": "#8c8c8c",
                      "textFontSize": 0,
                      "other": []
                    },
                    "more": {
                      "show": 0,
                      "url": "\/pages\/index\/category?id=21"
                    }
                  },
                  "style": {
                    "background": {
                      "type": "color",
                      "bgImage": "",
                      "bgColor": ""
                    },
                    "marginLeft": 8,
                    "marginRight": 8,
                    "marginTop": 0,
                    "marginBottom": 0,
                    "borderRadiusTop": 0,
                    "borderRadiusBottom": 0,
                    "padding": 0,
                    "height": 40
                  }
                },
                {
                  "type": "goodsCard",
                  "data": {
                    "mode": 3,
                    "goodsFields": {
                      "title": {
                        "show": 1,
                        "color": "#262626"
                      },
                      "subtitle": {
                        "show": 1,
                        "color": "#8C8C8C"
                      },
                      "price": {
                        "show": 1,
                        "color": "#F39800"
                      },
                      "original_price": {
                        "show": 1,
                        "color": "#C4C4C4"
                      },
                      "sales": {
                        "show": 1,
                        "color": "#C4C4C4"
                      },
                      "stock": {
                        "show": 0,
                        "color": "#C4C4C4"
                      }
                    },
                    "buyNowStyle": {
                      "mode": 1,
                      "text": "立即购买",
                      "color1": "#F39800",
                      "color2": "#f5796f",
                      "src": ""
                    },
                    "tagStyle": {
                      "show": 0,
                      "src": ""
                    },
                    "goodsIds": [
                      17,
                      18,
                      19
                    ],
                    "borderRadiusTop": 6,
                    "borderRadiusBottom": 6,
                    "space": 8
                  },
                  "style": {
                    "background": {
                      "type": "color",
                      "bgImage": "",
                      "bgColor": ""
                    },
                    "marginLeft": 8,
                    "marginRight": 8,
                    "marginTop": 0,
                    "marginBottom": 10,
                    "borderRadiusTop": 0,
                    "borderRadiusBottom": 0,
                    "padding": 0
                  }
                },
                {
                  "type": "titleBlock",
                  "data": {
                    "src": "\/storage\/decorate\/20221115\/ce9cb18e6cd8dda71287195d97fc5c2d.png",
                    "location": "left",
                    "skew": null,
                    "title": {
                      "text": "",
                      "color": "#262626",
                      "textFontSize": 16,
                      "other": []
                    },
                    "subtitle": {
                      "text": "",
                      "color": "#8c8c8c",
                      "textFontSize": 0,
                      "other": []
                    },
                    "more": {
                      "show": 0,
                      "url": "\/pages\/index\/category?id=21"
                    }
                  },
                  "style": {
                    "background": {
                      "type": "color",
                      "bgImage": "",
                      "bgColor": ""
                    },
                    "marginLeft": 8,
                    "marginRight": 8,
                    "marginTop": 0,
                    "marginBottom": 0,
                    "borderRadiusTop": 0,
                    "borderRadiusBottom": 0,
                    "padding": 0,
                    "height": 40
                  }
                },
                {
                  "type": "goodsCard",
                  "data": {
                    "mode": 2,
                    "goodsFields": {
                      "title": {
                        "show": 1,
                        "color": "#262626"
                      },
                      "subtitle": {
                        "show": 1,
                        "color": "#8C8C8C"
                      },
                      "price": {
                        "show": 1,
                        "color": "#F39800"
                      },
                      "original_price": {
                        "show": 1,
                        "color": "#C4C4C4"
                      },
                      "sales": {
                        "show": 1,
                        "color": "#C4C4C4"
                      },
                      "stock": {
                        "show": 0,
                        "color": "#C4C4C4"
                      }
                    },
                    "buyNowStyle": {
                      "mode": 2,
                      "text": "立即购买",
                      "color1": "#F39800",
                      "color2": "#f5796f",
                      "src": "\/storage\/decorate\/20221115\/4782356b4587dc4f4a218f2540a0bafc.png"
                    },
                    "tagStyle": {
                      "show": 0,
                      "src": ""
                    },
                    "goodsIds": [
                      14,
                      16,
                      12,
                      8,
                      9,
                      21
                    ],
                    "borderRadiusTop": 6,
                    "borderRadiusBottom": 6,
                    "space": 8
                  },
                  "style": {
                    "background": {
                      "type": "color",
                      "bgImage": "",
                      "bgColor": ""
                    },
                    "marginLeft": 8,
                    "marginRight": 8,
                    "marginTop": 0,
                    "marginBottom": 10,
                    "borderRadiusTop": 0,
                    "borderRadiusBottom": 0,
                    "padding": 0
                  }
                }
              ],
              "style": {
                "background": {
                  "color": "#F39800",
                  "src": ""
                },
                "navbar": {
                  "mode": "normal",
                  "alwaysShow": 1,
                  "type": "color",
                  "color": "#F39800",
                  "src": "",
                  "list": {
                    "mp": [
                      {
                        "width": 5,
                        "height": 1,
                        "top": 0,
                        "left": 0,
                        "type": "search",
                        "text": "",
                        "textColor": "#111111",
                        "src": "",
                        "url": "",
                        "placeholder": "请输入关键字",
                        "borderRadius": 20
                      },
                      {
                        "width": 1,
                        "height": 1,
                        "top": 0,
                        "left": 5,
                        "type": "image",
                        "text": "",
                        "textColor": "#111111",
                        "src": "\/storage\/decorate\/20221115\/6e30b6357d3285d7d007ac308e7b2b12.png",
                        "url": "\/pages\/coupon\/list",
                        "placeholder": "",
                        "borderRadius": 0
                      }
                    ],
                    "app": [
                      {
                        "width": 7,
                        "height": 1,
                        "top": 0,
                        "left": 0,
                        "type": "search",
                        "text": "",
                        "textColor": "#111111",
                        "src": "",
                        "url": "",
                        "placeholder": "请输入关键字",
                        "borderRadius": 23
                      },
                      {
                        "width": 1,
                        "height": 1,
                        "top": 0,
                        "left": 7,
                        "type": "image",
                        "text": "",
                        "textColor": "#111111",
                        "src": "\/storage\/decorate\/20221115\/6e30b6357d3285d7d007ac308e7b2b12.png",
                        "url": "\/pages\/coupon\/list",
                        "placeholder": "",
                        "borderRadius": 0
                      }
                    ]
                  }
                }
              }
            },
            "user": {
              "data": [
                {
                  "type": "userCard",
                  "style": {
                    "marginLeft": 0,
                    "marginRight": 0,
                    "marginTop": 10,
                    "marginBottom": 10,
                    "borderRadiusTop": 0,
                    "borderRadiusBottom": 0,
                    "background": {
                      "type": "color",
                      "bgImage": "",
                      "bgColor": ""
                    }
                  }
                },
                // {
                //   "type": "walletCard",
                //   "style": {
                //     "marginLeft": 10,
                //     "marginRight": 10,
                //     "marginTop": 0,
                //     "marginBottom": 8,
                //     "borderRadiusTop": 8,
                //     "borderRadiusBottom": 8,
                //     "padding": 0,
                //     "background": {
                //       "type": "color",
                //       "bgImage": "",
                //       "bgColor": "#FFFFFF"
                //     }
                //   }
                // },
                /*{
                  "type": "orderCard",
                  "style": {
                    "background": {
                      "type": "color",
                      "bgImage": "",
                      "bgColor": "#FFFFFF"
                    },
                    "marginLeft": 10,
                    "marginRight": 10,
                    "marginTop": 0,
                    "marginBottom": 8,
                    "borderRadiusTop": 8,
                    "borderRadiusBottom": 8,
                    "padding": 0
                  }
                },*/
                /*{
                  "type": "orderCardPre",
                  "style": {
                    "background": {
                      "type": "color",
                      "bgImage": "",
                      "bgColor": "#FFFFFF"
                    },
                    "marginLeft": 10,
                    "marginRight": 10,
                    "marginTop": 0,
                    "marginBottom": 8,
                    "borderRadiusTop": 8,
                    "borderRadiusBottom": 8,
                    "padding": 0
                  }
                },*/
                /*{
                    "type": "couponCard",
                    "style": {
                        "background": {
                            "type": "color",
                            "bgImage": "",
                            "bgColor": "#FFFFFF"
                        },
                        "marginLeft": 10,
                        "marginRight": 10,
                        "marginTop": 0,
                        "marginBottom": 8,
                        "borderRadiusTop": 8,
                        "borderRadiusBottom": 8,
                        "padding": 0
                    }
                },*/
                // {
                //     "type": "walletCard",
                //     "style": {
                //         "background": {
                //             "type": "color",
                //             "bgImage": "",
                //             "bgColor": "#FFFFFF"
                //         },
                //         "marginLeft": 10,
                //         "marginRight": 10,
                //         "marginTop": 0,
                //         "marginBottom": 8,
                //         "borderRadiusTop": 8,
                //         "borderRadiusBottom": 8,
                //         "padding": 0
                //     }
                // },
                {
                  "type": "menuGrid",
                  "data": {
                    "col": 3,
                    "list": [
                      {
                        "src": "https://ribotrade-oss.oss-cn-beijing.aliyuncs.com/2025/02/07a3caaac72dc54f3c82a8f302aa908145设置.png",
                        "title": {
                          "text": "设置",
                          "color": "#333"
                        },
                        "tip": {
                          "text": "",
                          "color": "#bbb"
                        },
                        "url": "\/pages\/public\/setting",
                        "badge": {
                          "show": 0,
                          "text": "",
                          "color": "#FFFFFF",
                          "bgColor": "#F39800"
                        }
                      },
                      // {
                      //   "src": "https://img.js.design/assets/img/671f57f27dd312149e390702.png#3a9739ca8d1c0a516cf9031e001a6e25",
                      //   "title": {
                      //     "text": "我的留言",
                      //     "color": "#333333"
                      //   },
                      //   "tip": {
                      //     "text": "",
                      //     "color": "#bbb"
                      //   },
                      //   "url": "\/pages\/index\/comment",
                      //   "badge": {
                      //     "show": 0,
                      //     "text": "",
                      //     "color": "#FFFFFF",
                      //     "bgColor": "#F39800"
                      //   }
                      // },
                      // {
                      //     "src": "\/storage\/decorate\/20221115\/ac3bdfced7c4c5f17f03b48f6d3fa3ec.png",
                      //     "title": {
                      //         "text": "收藏",
                      //         "color": "#333"
                      //     },
                      //     "tip": {
                      //         "text": "",
                      //         "color": "#bbb"
                      //     },
                      //     "url": "\/pages\/user\/goods-collect",
                      //     "badge": {
                      //         "show": 0,
                      //         "text": "",
                      //         "color": "#FFFFFF",
                      //         "bgColor": "#F39800"
                      //     }
                      // },
                      // {
                      //     "src": "\/storage\/decorate\/20221115\/94eb324f16b6b48e65c4ea1cf7d3c1fd.png",
                      //     "title": {
                      //         "text": "浏览足迹",
                      //         "color": "#333"
                      //     },
                      //     "tip": {
                      //         "text": "",
                      //         "color": "#bbb"
                      //     },
                      //     "url": "\/pages\/user\/goods-log",
                      //     "badge": {
                      //         "show": 0,
                      //         "text": "",
                      //         "color": "#FFFFFF",
                      //         "bgColor": "#F39800"
                      //     }
                      // },
                      {
                          "src": "https://ribotrade-oss.oss-cn-beijing.aliyuncs.com/2025/02/0783375ef75b5e477285971a601e5c5374意见.png",
                          "title": {
                              "text": "意见反馈",
                              "color": "#333"
                          },
                          "tip": {
                              "text": "",
                              "color": "#bbb"
                          },
                          "url": "\/pages\/public\/feedback",
                          "badge": {
                              "show": 0,
                              "text": "",
                              "color": "#FFFFFF",
                              "bgColor": "#F39800"
                          }
                      },
                      // {
                      //     "src": "\/storage\/decorate\/20221115\/0c37315a83f9424a4717ef684984c9c0.png",
                      //     "title": {
                      //         "text": "常见问题",
                      //         "color": "#333"
                      //     },
                      //     "tip": {
                      //         "text": "",
                      //         "color": "#bbb"
                      //     },
                      //     "url": "\/pages\/public\/faq",
                      //     "badge": {
                      //         "show": 0,
                      //         "text": "",
                      //         "color": "#FFFFFF",
                      //         "bgColor": "#F39800"
                      //     }
                      // },
                      // {
                      //     "src": "\/storage\/decorate\/20221115\/58fe6c2a400d6d18a43949f3d8c58021.png",
                      //     "title": {
                      //         "text": "积分商城",
                      //         "color": "#333"
                      //     },
                      //     "tip": {
                      //         "text": "",
                      //         "color": "#bbb"
                      //     },
                      //     "url": "\/pages\/app\/score-shop",
                      //     "badge": {
                      //         "show": 0,
                      //         "text": "",
                      //         "color": "#FFFFFF",
                      //         "bgColor": "#F39800"
                      //     }
                      // },
                      // {
                      //     "src": "\/storage\/decorate\/20221115\/6d0a8c85ba41464b5493226c91c72459.png",
                      //     "title": {
                      //         "text": "关于我们",
                      //         "color": "#333"
                      //     },
                      //     "tip": {
                      //         "text": "",
                      //         "color": "#bbb"
                      //     },
                      //     "url": "\/pages\/public\/richtext?id=3",
                      //     "badge": {
                      //         "show": 0,
                      //         "text": "",
                      //         "color": "#FFFFFF",
                      //         "bgColor": "#F39800"
                      //     }
                      // },
                      {
                        "src": "https://ribotrade-oss.oss-cn-beijing.aliyuncs.com/2025/01/0406a41f9e4ca748c9b88a2ae0afe397bclogo (3).png",
                        "title": {
                          "text": "联系IM",
                          "color": "#333"
                        },
                        "tip": {
                          "text": "",
                          "color": "#bbb"
                        },
                        "url": "\/pages\/goods\/comment\/list",
                        "badge": {
                          "show": 0,
                          "text": "",
                          "color": "#FFFFFF",
                          "bgColor": "#F39800"
                        }
                      },
                      // {
                      //   "src": "https://img.js.design/assets/img/671f58c0f7d5bb28b653a868.png#da921320ae4156a6121fa0b5971e8eeb",
                      //   "title": {
                      //     "text": "收货地址",
                      //     "color": "#333"
                      //   },
                      //   "tip": {
                      //     "text": "",
                      //     "color": "#bbb"
                      //   },
                      //   "url": "\/pages\/user\/address\/list",
                      //   "badge": {
                      //     "show": 0,
                      //     "text": "",
                      //     "color": "#FFFFFF",
                      //     "bgColor": "#F39800"
                      //   }
                      // },
                      //{
                      //  "src": "https://xiaozhan-shop.oss-cn-beijing.aliyuncs.com/2023/12/10c9a887e702dd484086b25b10eb7a86c7img.png",
                      //  "title": {
                      //    "text": "解锁平铺",
                      //    "color": "#333"
                      //  },
                      //  "tip": {
                      //    "text": "",
                      //    "color": "#bbb"
                      //  },
                      //  "url": "\/pages\/app\/storageMulti",
                      //  "badge": {
                      //    "show": 0,
                      //    "text": "",
                      //    "color": "#FFFFFF",
                      //    "bgColor": "#F39800"
                      //  }
                      //},
                      //{
                      //  "src": "https://xiaozhan-shop.oss-cn-beijing.aliyuncs.com/2023/12/10ce5dd09718024cde954b9a26cea3a91bwareadd.png",
                      //  "title": {
                      //    "text": "商品入库",
                      //    "color": "#333"
                      //  },
                      //  "tip": {
                      //    "text": "",
                      //    "color": "#bbb"
                      //  },
                      //  "url": "\/pages\/app\/sign",
                      //  "badge": {
                      //    "show": 0,
                      //    "text": "",
                      //    "color": "#FFFFFF",
                      //    "bgColor": "#F39800"
                      //  }
                      //},
                      //{
                      //  "src": "https://xiaozhan-shop.oss-cn-beijing.aliyuncs.com/2023/12/10ade2b283ca564f79852e4f276ba6fbe6makepack.png",
                      //  "title": {
                      //    "text": "打包出库",
                      //    "color": "#333"
                      //  },
                      //  "tip": {
                      //    "text": "",
                      //    "color": "#bbb"
                      //  },
                      //  "url": "\/pages\/app\/pack",
                      //  "badge": {
                      //    "show": 0,
                      //    "text": "",
                      //    "color": "#FFFFFF",
                      //    "bgColor": "#F39800"
                      //  }
                      //},
                      //{
                      //  "src": "https://xiaozhan-shop.oss-cn-beijing.aliyuncs.com/2023/12/10cc424a3d5bc34fb88f40bc0f4e007eb8merge.png",
                      //  "title": {
                      //    "text": "拼邮合箱",
                      //    "color": "#333"
                      //  },
                      //  "tip": {
                      //    "text": "",
                      //    "color": "#bbb"
                      //  },
                      //  "url": "\/pages\/app\/move",
                      //  "badge": {
                      //    "show": 0,
                      //    "text": "",
                      //    "color": "#FFFFFF",
                      //    "bgColor": "#F39800"
                      //  }
                      //},
                      //{
                      //  "src": "https://xiaozhan-shop.oss-cn-beijing.aliyuncs.com/2024/06/26cd632d9c210f4d2ba5af1b1a4abec311pack_category.png",
                      //  "title": {
                      //    "text": "拼邮分类",
                      //    "color": "#333"
                      //  },
                      //  "tip": {
                      //    "text": "",
                      //    "color": "#bbb"
                      //  },
                      //  "url": "\/pages\/app\/packCategory",
                      //  "badge": {
                      //    "show": 0,
                      //    "text": "",
                      //    "color": "#FFFFFF",
                      //    "bgColor": "#F39800"
                      //  }
                      //},
                    ]
                  },
                  "style": {
                    "background": {
                      "type": "color",
                      "bgImage": "",
                      "bgColor": "#FFFFFF"
                    },
                    "marginLeft": 10,
                    "marginRight": 10,
                    "marginTop": 0,
                    "marginBottom": 10,
                    "borderRadiusTop": 8,
                    "borderRadiusBottom": 8,
                    "padding": 0
                  }
                }
              ],
              "style": {
                "background": {
                  "color": "#F6F6F6",
                  "src": ""
                },
                "navbar": {
                  "mode": "inner",
                  "alwaysShow": 1,
                  "type": "image",
                  "color": "",
                  "src": "",
                  "list": {
                    "mp": [
                      {
                        "width": 1,
                        "height": 1,
                        "top": 0,
                        "left": 0,
                        "type": "image",
                        "text": "",
                        "textColor": "#111111",
                        "src": "\/storage\/decorate\/20221115\/c47b048175b325b1e78f837a3b696794.png",
                        "url": "\/pages\/chat\/index",
                        "placeholder": "",
                        "borderRadius": 0
                      },
                      {
                        "width": 1,
                        "height": 1,
                        "top": 0,
                        "left": 1,
                        "type": "image",
                        "text": "",
                        "textColor": "#111111",
                        "src": "\/storage\/decorate\/20221115\/f09ef51624e48d7d8c58cd602110c46e.png",
                        "url": "\/pages\/commission\/goods",
                        "placeholder": "",
                        "borderRadius": 0
                      }
                    ],
                    "app": [
                      {
                        "width": 1,
                        "height": 1,
                        "top": 0,
                        "left": 0,
                        "type": "image",
                        "text": "",
                        "textColor": "#111111",
                        "src": "\/storage\/decorate\/20221115\/c47b048175b325b1e78f837a3b696794.png",
                        "url": "\/pages\/chat\/index",
                        "placeholder": "",
                        "borderRadius": 0
                      },
                      {
                        "width": 1,
                        "height": 1,
                        "top": 0,
                        "left": 1,
                        "type": "image",
                        "text": "",
                        "textColor": "#111111",
                        "src": "\/storage\/decorate\/20221115\/f09ef51624e48d7d8c58cd602110c46e.png",
                        "url": "\/pages\/commission\/goods",
                        "placeholder": "",
                        "borderRadius": 0
                      }
                    ]
                  }
                }
              }
            }
          },
          "chat": {
            "room_id": "admin",
            "chat_domain": "https:\/\/api.shopro.sheepjs.com\/chat"
          }
        }
      }
      if (res.error === 0) {
        this.info = res.data.app;
        this.platform = res.data.platform;
        this.template = res.data.template;
        if (!res.data.template) {
          $router.error('TemplateError');
        }
        this.chat = res.data.chat;

        console.log(uni.getStorageSync('userInfo'))
        let userInfo = uni.getStorageSync('userInfo')

        // 加载主题
        const sysStore = sys();
        sysStore.setTheme();

        // 模拟用户登录
        const userStore = user();
        /*if (userStore.isLogin) {
          userStore.loginAfter();
        }*/
        return Promise.resolve(true);
      } else {
        $router.error('InitError', res.msg || '加载失败');
      }
    },
  },
  persist: {
    enabled: true,
    strategies: [
      {
        key: 'app-store',
      },
    ],
  },
});

export default app;
